**************************************************************
*HURRICANES AND GAS GOUGING - MAIN PRICE AND MARGIN REGRESSIONS
**************************************************************
frame copy default price_regs, replace
frame change price_regs
keep if sample_main==1
gsort station_id date


********************************************************************************
*TABLE 2: EFFECT OF HURRICANES ON RETAIL AND WHOLESALE PRICES AND MARGINS
* Notes: - Define three indicators: 
*           (i) Impact - 3 days before landfall, landfall, and 3 days after landfall
*           (ii) Pre-Impact - 10 days to 4 days before landfall
*           (iii) Post-Impact - 4 days to 10 days after landfall 
********************************************************************************

*****************
* PANEL A - AVERAGE HURRICANE IMPACTS ON RETAIL AND WHOLESALE PRICES
*****************
eststo clear 		   
*Column 1 - Retail 1
reghdfe retail pre_hur hur post_hur CTST CHRT CTSN CHRN temp temp2, ///
			   absorb(state_name year month dow) cluster(county_FIPS)	   
	gdistinct station_id if e(sample)
	estadd scalar n_stats = r(ndistinct) 
	estadd local state_fe "Yes"
	estadd local station_fe "No"
	estadd local year_fe "Yes"
	estadd local month_fe "Yes"
	estadd local dow_fe "Yes"
est store A
			   
*Column 2 - Retail 2
reghdfe retail pre_hur hur post_hur CTST CHRT CTSN CHRN temp temp2, ///
			   absorb(station_id year month dow) cluster(county_FIPS)	
	gdistinct station_id if e(sample)
	estadd scalar n_stats = r(ndistinct) 
	estadd local state_fe "No"
	estadd local station_fe "Yes"
	estadd local year_fe "Yes"
	estadd local month_fe "Yes"	
	estadd local dow_fe "Yes"	
est store B

*Column 3 - Wholesale 1
	reghdfe wholesale pre_hur hur post_hur CTST CHRT CTSN CHRN temp temp2, ///
			   absorb(state_name year month dow) cluster(nearRack1)
	gdistinct nearRack1 if e(sample)
	estadd scalar n_stats = r(ndistinct) 
	estadd local state_fe "Yes"
	estadd local station_fe "No"
	estadd local year_fe "Yes"
	estadd local month_fe "Yes"
	estadd local dow_fe "Yes"	
est store C
			   
*Column 4 - Wholesale 2
reghdfe wholesale pre_hur hur post_hur CTST CHRT CTSN CHRN temp temp2, ///
			   absorb(nearRack1 year month dow) cluster(nearRack1)		
	gdistinct nearRack1 if e(sample)
	estadd scalar n_stats = r(ndistinct) 
	estadd local state_fe "No"
	estadd local station_fe "Yes"
	estadd local year_fe "Yes"
	estadd local month_fe "Yes"	
	estadd local dow_fe "Yes"	
est store D

esttab A B C D using "$output/price_regs_main1a_$outputdate.csv", replace label ///
     b(a2) nonumber ///
    starlevels(* 0.10 ** 0.05 *** 0.01) ///
	title(Average Effect of Hurricanes on Retail Prices, Wholesale Prices, and Margins)  ///
	cells(b(fmt(3) star) se(fmt(3) par)) ///
	drop(_cons CTST CHRT CTSN CHRN temp temp2) ///
	note(Notes: The dependent variable is station-level retail/wholesale ///
	     price. "Pre-Hurricane" is an indicator variable for whether a station ///
		 lies in an area impacted by a hurricane or coastal area five ///
		 days before a hurricane warning was issued. "Hurricane" and ///
		 "Post-Hurricane" are similar indicator variables for days during a ///
		 hurricane warning and the five-days after a hurricane warning, ///
		 respectively. Standard errors are clustered at the ///
		 county for retail regressions and wholesale rack for wholesale ///
		 regressions. *, **, and ***   denote significance at ///
		 the 10\%, 5\%, and 1\% level.) ///
	coef(pre_hur "Pre-Hurricane" hur "Hurricane" post_hur "Post-Hurricane") ///
	scalars("n_stats Stations/Racks" "state_fe State FE"  ///
	        "station_fe Station/Rack FE" "year_fe Year FE" ///
			"month_fe Month-of-Year FE" "dow_fe Day-of-Week FE")  ///
			 sfmt(%8.0f) mlabels((1) (2) (3) (4)) collabels(none) 


*****************
* PANEL B - AVERAGE HURRICANE IMPACTS ON RETAIL AND WHOLESALE MARGINS
*****************
eststo clear 		   
*Column 1 - Retail 1
reghdfe retail pre_hur hur post_hur wholesale CTST CHRT CTSN CHRN temp temp2, ///
			   absorb(state_name year month dow) cluster(county_FIPS)	   
	gdistinct station_id if e(sample)
	estadd scalar n_stats = r(ndistinct) 
	estadd local state_fe "Yes"
	estadd local station_fe "No"
	estadd local year_fe "Yes"
	estadd local month_fe "Yes"
	estadd local dow_fe "Yes"	
est store A
			   
*Column 2 - Retail 2
reghdfe retail pre_hur hur post_hur wholesale CTST CHRT CTSN CHRN temp temp2, ///
			   absorb(station_id year month dow) cluster(county_FIPS)			   
	gdistinct station_id if e(sample)
	estadd scalar n_stats = r(ndistinct) 
	estadd local state_fe "No"
	estadd local station_fe "Yes"
	estadd local year_fe "Yes"
	estadd local month_fe "Yes"	
	estadd local dow_fe "Yes"	
est store B

*Column 3 - Wholesale 1
reghdfe wholesale pre_hur hur post_hur bulk CTST CHRT CTSN CHRN temp temp2, ///
			   absorb(state_name year month) cluster(nearRack1)
	gdistinct nearRack1 if e(sample)
	estadd scalar n_stats = r(ndistinct) 
	estadd local state_fe "Yes"
	estadd local station_fe "No"
	estadd local year_fe "Yes"
	estadd local month_fe "Yes"
	estadd local dow_fe "Yes"	
est store C
			   
*Column 4 - Wholesale 2
reghdfe wholesale pre_hur hur post_hur bulk CTST CHRT CTSN CHRN temp temp2, ///
			   absorb(nearRack1 year month) cluster(nearRack1) 		
	gdistinct nearRack1 if e(sample)
	estadd scalar n_stats = r(ndistinct) 
	estadd local state_fe "No"
	estadd local station_fe "Yes"
	estadd local year_fe "Yes"
	estadd local month_fe "Yes"		
	estadd local dow_fe "Yes"	
est store D

esttab A B C D using "$output/price_regs_main1b_$outputdate.csv", replace label ///
     b(a2) nonumber ///
    starlevels(* 0.10 ** 0.05 *** 0.01) ///
	title(Average Effect of Hurricanes on Retail Prices, Wholesale Prices, and Margins  \label{tab:price_main1b})  ///
	cells(b(fmt(3) star) se(fmt(3) par)) ///
	drop(_cons CTST CHRT CTSN CHRN temp temp2) ///
	note(Notes: The dependent variable is station-level retail/wholesale ///
	     price. "Pre-Hurricane" is an indicator variable for whether a station ///
		 lies in an area impacted by a hurricane or coastal area five ///
		 days before a hurricane warning was issued. "Hurricane" and ///
		 "Post-Hurricane" are similar indicator variables for days during a ///
		 hurricane warning and the five-days after a hurricane warning, ///
		 respectively. Standard errors are clustered at the ///
		 county for retail regressions and wholesale rack for wholesale ///
		 regressions. *, **, and ***   denote significance at ///
		 the 10\%, 5\%, and 1\% level.) ///
	coef(pre_hur "Pre-Hurricane" hur "Hurricane" post_hur "Post-Hurricane") ///
	scalars("n_stats Stations/Racks" "state_fe State FE"  ///
	        "station_fe Station/Rack FE" "year_fe Year FE" ///
			"month_fe Month-of-Year FE" "dow_fe Day-of-Week FE")  ///
			 sfmt(%8.0f) mlabels((1) (2) (3) (4)) collabels(none) 
			 

********************************************************************************
*FIGURE 2 - RETAIL PRICE AND MARGIN EVENT STUDIES 
********************************************************************************
*
*Creating day 0 event-study indicators
gsort station_id date
gen hur_landfall_d0=0 
	replace hur_landfall_d0=1 if BONCHAR_landfall==1 & date==`=td(12aug2004)'
	replace hur_landfall_d0=1 if FRANCES_landfall==1 & date==`=td(06sep2004)'
	replace hur_landfall_d0=1 if IVAN_landfall==1 & date==`=td(16sep2004)'
	replace hur_landfall_d0=1 if JEANNE_landfall==1 & date==`=td(26sep2004)'
	replace hur_landfall_d0=1 if ARLENE_landfall==1 & date==`=td(11jun2005)'
	replace hur_landfall_d0=1 if DENNIS_landfall==1 & date==`=td(10jul2005)'
	replace hur_landfall_d0=1 if KATRINA_FL_landfall==1 & date==`=td(25aug2005)'
	replace hur_landfall_d0=1 if KATRINA_LA_landfall==1 & date==`=td(29aug2005)'
	replace hur_landfall_d0=1 if RITA_landfall==1 & date==`=td(24sep2005)'
	replace hur_landfall_d0=1 if WILMA_landfall==1 & date==`=td(24oct2005)'
	replace hur_landfall_d0=1 if ALBERTO_landfall==1 & date==`=td(13jun2006)'
	replace hur_landfall_d0=1 if HUMBERTO_landfall==1 & date==`=td(13sep2007)'
	replace hur_landfall_d0=1 if GUSTAV_landfall==1 & date==`=td(01sep2008)'
	replace hur_landfall_d0=1 if IKE_landfall==1 & date==`=td(13sep2008)'
*	
*Creating 14-day event windows   
gen event_day=. //Event day variable
	replace event_day=0 if hur_landfall_d0==1
	
*Indicators: 14 Days Prior to Hurricane for Different Samples
forvalues t = 1/14 {
	local n=-1*(`t')
	*Year check
	gen y=f`t'.year
	*Landfall 
	gen hur_landfall_dn`t' = 0
		replace hur_landfall_dn`t' = 1 if f`t'.hur_landfall_d0==1 & y==year
	*Event day  
	replace event_day=`n' if hur_landfall_dn`t'==1
		
	drop y
}
*
*Indicators: 14 Days After Hurricane
forvalues t = 1/14 {
	*Year check
	gen y=l`t'.year
	*Landfall indicator
	gen hur_landfall_d`t' = 0		
		replace hur_landfall_d`t' = 1 if l`t'.hur_landfall_d0==1 & y==year
	*Event day  
	replace event_day=`t' if hur_landfall_d`t'==1
	drop y		
}
*
order hur_landfall_dn14 hur_landfall_dn13 hur_landfall_dn12 hur_landfall_dn11 ///
      hur_landfall_dn10 hur_landfall_dn9 hur_landfall_dn8 hur_landfall_dn7 ///
	  hur_landfall_dn6 hur_landfall_dn5 hur_landfall_dn4 hur_landfall_dn3 ///
	  hur_landfall_dn2 hur_landfall_dn1 hur_landfall_d0 hur_landfall_d1 ///
	  hur_landfall_d2 hur_landfall_d3 hur_landfall_d4 hur_landfall_d5 ///
	  hur_landfall_d6 hur_landfall_d7 hur_landfall_d8 hur_landfall_d9 ///
	  hur_landfall_d10 hur_landfall_d11 hur_landfall_d12 hur_landfall_d13 ///
	  hur_landfall_d14, last
*
*Event window indicators 
egen window_landfall=rowtotal(hur_landfall_dn14-hur_landfall_d14)  //Event study - Landfall
*
*
***********************************
*FIGURE 2(A) - PRICE IMPACTS
gen d=. in 1
gen xb_hur1 = . in 1
	gen hi_hur1 = . in 1
	gen lo_hur1 = . in 1	
gen xb_hur2 = . in 1
	gen hi_hur2 = . in 1
	gen lo_hur2 = . in 1
gen xb_hur3 = . in 1
	gen hi_hur3 = . in 1
	gen lo_hur3 = . in 1

*****
*Hurricane Landfall Areas - Price	
reghdfe retail hur_landfall_dn14-hur_landfall_d14 ///
		CTST CHRT CTSN CHRN temp temp2 if window_landfall>=1, ///
	    absorb(station_id year month dow) cluster(county_FIPS ym)
*
replace d=-14 in 1
replace xb_hur1=0 in 1
replace hi_hur1=0 in 1
replace lo_hur1=0 in 1
*
forvalues i = 2/14 {
	local j=-1*(`i'-15)
	replace d=-1*`j' in `i'	
	lincom hur_landfall_dn`j'-hur_landfall_dn14
	replace xb_hur1    = r(estimate) in `i'
	replace hi_hur1 = r(estimate) + 1.96*r(se)  in `i'
	replace lo_hur1 = r(estimate) - 1.96*r(se) in `i'

}
*
forvalues i = 0/14 {
	local j=`i'+15
	replace d=`i' in `j'
	lincom hur_landfall_d`i'-hur_landfall_dn14
	replace xb_hur1    = r(estimate) in `j'
	replace hi_hur1 = r(estimate) + 1.96*r(se)  in `j'
	replace lo_hur1 = r(estimate) - 1.96*r(se) in `j'
}
*
*Graph
tw(connected xb_hur1 d, m(T) mfcolor(white) mlcolor(black) msize(medium) lcolor(edkblue) lwidth(medthick) mlwidth(medium)) ///
	(line hi_hur1 d, lpattern(dash) lcolor(erose)) ///
	(line lo_hur1 d, lpattern(dash) lcolor(erose)), ///
	graphr(color(white)) ///
	yscale(noline) ///
	xtit("Days Before/After Hurricane Landfall") ///
	ytit("Price ($/gal)") ///
	ylabel(-0.1(0.05)0.1 ,nogrid angle(0)) ///
	xlabel(-14(2)14) ///
	yline(0, lcolor(black))   ///
	xline(0,lcolor(black) lp(dash)) ///
	legend(off)  
graph export $figs/event_prices_$outputdate.png, replace width(4000)
drop d-lo_hur3


***********************************
*FIGURE 2(A) - MARGINS IMPACTS
gen d=. in 1
gen xb_hur1 = . in 1
	gen hi_hur1 = . in 1
	gen lo_hur1 = . in 1	
gen xb_hur2 = . in 1
	gen hi_hur2 = . in 1
	gen lo_hur2 = . in 1
gen xb_hur3 = . in 1
	gen hi_hur3 = . in 1
	gen lo_hur3 = . in 1
	
*****
*Hurricane Landfall Areas - Margins		
reghdfe retail hur_landfall_dn14-hur_landfall_d14 ///
		CTST CHRT CTSN CHRN temp temp2 wholesale if window_landfall>=1, ///
	    absorb(station_id year month dow) cluster(county_FIPS ym)	
*			
replace d=-14 in 1
replace xb_hur1=0 in 1
replace hi_hur1=0 in 1
replace lo_hur1=0 in 1
*
forvalues i = 2/14 {
	local j=-1*(`i'-15)
	replace d=-1*`j' in `i'	
	lincom hur_landfall_dn`j'-hur_landfall_dn14
	replace xb_hur1    = r(estimate) in `i'
	replace hi_hur1 = r(estimate) + 1.96*r(se)  in `i'
	replace lo_hur1 = r(estimate) - 1.96*r(se) in `i'

}
*
forvalues i = 0/14 {
	local j=`i'+15
	replace d=`i' in `j'
	lincom hur_landfall_d`i'-hur_landfall_dn14
	replace xb_hur1    = r(estimate) in `j'
	replace hi_hur1 = r(estimate) + 1.96*r(se)  in `j'
	replace lo_hur1 = r(estimate) - 1.96*r(se) in `j'
}
*
*Graph
tw(connected xb_hur1 d, m(O) mfcolor(white) mlcolor(black) msize(medium) lcolor(cranberry) lwidth(medthick) mlwidth(medium)) ///
	(line hi_hur1 d, lpattern(dash) lcolor(erose)) ///
	(line lo_hur1 d, lpattern(dash) lcolor(erose)), ///
	graphr(color(white)) ///
	yscale(noline) ///
	xtit("Days Before/After Hurricane Landfall") ///
	ytit("Margin ($/gal)") ///
	ylabel(-0.1(0.05)0.1 ,nogrid angle(0)) ///
	xlabel(-14(2)14) ///
	yline(0, lcolor(black))   ///
	xline(0,lcolor(black) lp(dash)) ///
	legend(off)  
graph export $figs/event_margins_$outputdate.png, replace width(4000)
drop d-lo_hur3

			 
********************************************************************************
*FIGURE 3 - TREATMENT EFFECT HETEROGENEITY
********************************************************************************
*			 
***********************************
*FIGURE 3(A) -  BRANDED/RETAILER/UNBRANDED MARGINS
gen d=. in 1
gen xb_hur1 = . in 1
	gen hi_hur1 = . in 1
	gen lo_hur1 = . in 1	
gen xb_hur2 = . in 1
	gen hi_hur2 = . in 1
	gen lo_hur2 = . in 1
gen xb_hur3 = . in 1
	gen hi_hur3 = . in 1
	gen lo_hur3 = . in 1
	
*Branded
forvalues t = 1/14 {
	gen hur_brand_dn`t'=hur_landfall_dn`t'*brand_maj 
}
*
gen hur_brand_d0=hur_landfall_d0*brand_maj 
forvalues t = 1/14 {
	gen hur_brand_d`t' = hur_landfall_d`t'*brand_maj 		
}
*
*Retail Major
forvalues t = 1/14 {
	gen hur_ret_dn`t'=hur_landfall_dn`t'*ret_maj 
}
*
gen hur_ret_d0=hur_landfall_d0*ret_maj 
forvalues t = 1/14 {
	gen hur_ret_d`t' = hur_landfall_d`t'*ret_maj 		
}
*
*Unbranded
forvalues t = 1/14 {
	gen hur_unbrand_dn`t'=hur_landfall_dn`t'*unbranded 
}
*
gen hur_unbrand_d0=hur_landfall_d0*unbranded 
forvalues t = 1/14 {
	gen hur_unbrand_d`t' = hur_landfall_d`t'*unbranded 		
}
*
*****
*Hurricane Margins
reghdfe retail hur_brand_dn1-hur_unbrand_d14 ///
		CTST CHRT CTSN CHRN temp temp2 wholesale if window_landfall>=1, ///
	    absorb(station_id year month dow) cluster(county_FIPS)	
*			
replace d=-14 in 1
replace xb_hur1=0 in 1
replace hi_hur1=0 in 1
replace lo_hur1=0 in 1
*
forvalues i = 2/14 {
	local j=-1*(`i'-15)
	replace d=-1*`j' in `i'	
	lincom hur_brand_dn`j'-hur_brand_dn14
	replace xb_hur1    = r(estimate) in `i'
	replace hi_hur1 = r(estimate) + 1.96*r(se)  in `i'
	replace lo_hur1 = r(estimate) - 1.96*r(se) in `i'

}
*
forvalues i = 0/14 {
	local j=`i'+15
	replace d=`i' in `j'
	lincom hur_brand_d`i'-hur_brand_dn14
	replace xb_hur1    = r(estimate) in `j'
	replace hi_hur1 = r(estimate) + 1.96*r(se)  in `j'
	replace lo_hur1 = r(estimate) - 1.96*r(se) in `j'
}
*	
forvalues i = 2/14 {
	local j=-1*(`i'-15)
	lincom hur_ret_dn`j'-hur_ret_dn14
	replace xb_hur2    = r(estimate) in `i'
	replace hi_hur2 = r(estimate) + 1.96*r(se)  in `i'
	replace lo_hur2 = r(estimate) - 1.96*r(se) in `i'

}
*
forvalues i = 0/14 {
	local j=`i'+15
	lincom hur_ret_d`i'-hur_ret_dn14
	replace xb_hur2    = r(estimate) in `j'
	replace hi_hur2 = r(estimate) + 1.96*r(se)  in `j'
	replace lo_hur2 = r(estimate) - 1.96*r(se) in `j'
}
*		
forvalues i = 2/14 {
	local j=-1*(`i'-15)
	lincom hur_unbrand_dn`j'-hur_unbrand_dn14
	replace xb_hur3    = r(estimate) in `i'
	replace hi_hur3 = r(estimate) + 1.96*r(se)  in `i'
	replace lo_hur3 = r(estimate) - 1.96*r(se) in `i'

}
*
forvalues i = 0/14 {
	local j=`i'+15
	lincom hur_unbrand_d`i'-hur_unbrand_dn14
	replace xb_hur3    = r(estimate) in `j'
	replace hi_hur3 = r(estimate) + 1.96*r(se)  in `j'
	replace lo_hur3 = r(estimate) - 1.96*r(se) in `j'
}
*
*Graph
tw(connected xb_hur2 d, m(D) mfcolor(white) mlcolor(black) msize(medium) lcolor(dkorange) lwidth(medthick) mlwidth(medium)) ///
  (connected xb_hur3 d, m(T) mfcolor(white) mlcolor(black) msize(medium) lcolor(edkblue) lwidth(medthick) mlwidth(medium)) ///
  (connected xb_hur1 d, m(O) mfcolor(white) mlcolor(black) msize(medium) lcolor(cranberry) lwidth(medthick) mlwidth(medium)) ///
  	(line hi_hur1 d, lpattern(dash) lcolor(erose)) ///
	(line lo_hur1 d, lpattern(dash) lcolor(erose)), ///, ///
	graphr(color(white)) ///
	yscale(noline) ///
	xtit("Days Before/After Hurricane Landfall") ///
	ytit("Margin ($/gal)") ///
	ylabel(-0.1(0.05)0.1 ,nogrid angle(0)) ///
	xlabel(-14(2)14) ///
	yline(0, lcolor(black))   ///
	xline(0,lcolor(black) lp(dash)) ///
	legend(order(3 "Branded" 1 "Retailer" 2 "Unbranded") size(vsmall) ///
	    region(lcolor(white)) cols(1) ring(0) position(11))  
graph export $figs/event_margins_branded_$outputdate.png, replace width(4000)
drop d-hur_unbrand_d14
*
*
***********************************
*FIGURE 3(B) - HIGH/MID/LOW COMPETITION MARGINS
gen d=. in 1
gen xb_hur1 = . in 1
	gen hi_hur1 = . in 1
	gen lo_hur1 = . in 1	
gen xb_hur2 = . in 1
	gen hi_hur2 = . in 1
	gen lo_hur2 = . in 1
gen xb_hur3 = . in 1
	gen hi_hur3 = . in 1
	gen lo_hur3 = . in 1
	
*Competition Low
forvalues t = 1/14 {
	gen hur_low_dn`t'=hur_landfall_dn`t'*comp_lo 
}
*
gen hur_low_d0=hur_landfall_d0*comp_lo 
forvalues t = 1/14 {
	gen hur_low_d`t' = hur_landfall_d`t'*comp_lo 		
}
*
*Competition Mid
forvalues t = 1/14 {
	gen hur_mid_dn`t'=hur_landfall_dn`t'*comp_mid 
}
*
gen hur_mid_d0=hur_landfall_d0*comp_mid 
forvalues t = 1/14 {
	gen hur_mid_d`t' = hur_landfall_d`t'*comp_mid 		
}
*
*Competition High
forvalues t = 1/14 {
	gen hur_high_dn`t'=hur_landfall_dn`t'*comp_hi 
}
*
gen hur_high_d0=hur_landfall_d0*comp_hi 
forvalues t = 1/14 {
	gen hur_high_d`t' = hur_landfall_d`t'*comp_hi 		
}
*
*****
*Hurricane Margins
reghdfe retail hur_low_dn1-hur_high_d14 ///
		CTST CHRT CTSN CHRN temp temp2 wholesale if window_landfall>=1, ///
	    absorb(station_id year month dow) cluster(county_FIPS)	
*			
replace d=-14 in 1
replace xb_hur1=0 in 1
replace hi_hur1=0 in 1
replace lo_hur1=0 in 1
*
forvalues i = 2/14 {
	local j=-1*(`i'-15)
	replace d=-1*`j' in `i'	
	lincom hur_low_dn`j'-hur_low_dn14
	replace xb_hur1    = r(estimate) in `i'
	replace hi_hur1 = r(estimate) + 1.96*r(se)  in `i'
	replace lo_hur1 = r(estimate) - 1.96*r(se) in `i'

}
*
forvalues i = 0/14 {
	local j=`i'+15
	replace d=`i' in `j'
	lincom hur_low_d`i'-hur_low_dn14
	replace xb_hur1    = r(estimate) in `j'
	replace hi_hur1 = r(estimate) + 1.96*r(se)  in `j'
	replace lo_hur1 = r(estimate) - 1.96*r(se) in `j'
}
*	
forvalues i = 2/14 {
	local j=-1*(`i'-15)
	lincom hur_mid_dn`j'-hur_mid_dn14
	replace xb_hur2    = r(estimate) in `i'
	replace hi_hur2 = r(estimate) + 1.96*r(se)  in `i'
	replace lo_hur2 = r(estimate) - 1.96*r(se) in `i'

}
*
forvalues i = 0/14 {
	local j=`i'+15
	lincom hur_mid_d`i'-hur_mid_dn14
	replace xb_hur2    = r(estimate) in `j'
	replace hi_hur2 = r(estimate) + 1.96*r(se)  in `j'
	replace lo_hur2 = r(estimate) - 1.96*r(se) in `j'
}
*		
forvalues i = 2/14 {
	local j=-1*(`i'-15)
	lincom hur_high_dn`j'-hur_high_dn14
	replace xb_hur3    = r(estimate) in `i'
	replace hi_hur3 = r(estimate) + 1.96*r(se)  in `i'
	replace lo_hur3 = r(estimate) - 1.96*r(se) in `i'

}
*
forvalues i = 0/14 {
	local j=`i'+15
	lincom hur_high_d`i'-hur_high_dn14
	replace xb_hur3    = r(estimate) in `j'
	replace hi_hur3 = r(estimate) + 1.96*r(se)  in `j'
	replace lo_hur3 = r(estimate) - 1.96*r(se) in `j'
}
*
*Graph
tw(connected xb_hur2 d, m(D) mfcolor(white) mlcolor(black) msize(medium) lcolor(dkorange) lwidth(medthick) mlwidth(medium)) ///
  (connected xb_hur3 d, m(T) mfcolor(white) mlcolor(black) msize(medium) lcolor(edkblue) lwidth(medthick) mlwidth(medium)) ///
  (connected xb_hur1 d, m(O) mfcolor(white) mlcolor(black) msize(medium) lcolor(cranberry) lwidth(medthick) mlwidth(medium)) ///
  	(line hi_hur1 d, lpattern(dash) lcolor(erose)) ///
	(line lo_hur1 d, lpattern(dash) lcolor(erose)), ///, ///
	graphr(color(white)) ///
	yscale(noline) ///
	xtit("Days Before/After Hurricane Landfall") ///
	ytit("Margin ($/gal)") ///
	ylabel(-0.1(0.05)0.1 ,nogrid angle(0)) ///
	xlabel(-14(2)14) ////
	yline(0, lcolor(black))   ///
	xline(0,lcolor(black) lp(dash)) ///
	legend(order(3 "0 Competitors" 1 "1-2 Competitors" 2 ">2 Competitors") size(vsmall) ///
	    region(lcolor(white)) cols(1) ring(0) position(11))  
graph export $figs/event_margins_competition_$outputdate.png, replace width(4000)
drop d-hur_high_d14
*
*
***********************************
*FIGURE 3(C) - NEAR/MID/FAR FROM HIGHWAY MARGINS
gen d=. in 1
gen xb_hur1 = . in 1
	gen hi_hur1 = . in 1
	gen lo_hur1 = . in 1	
gen xb_hur2 = . in 1
	gen hi_hur2 = . in 1
	gen lo_hur2 = . in 1
gen xb_hur3 = . in 1
	gen hi_hur3 = . in 1
	gen lo_hur3 = . in 1
*  
*Highway Close  
forvalues t = 1/14 {
	gen hur_close_dn`t'=hur_landfall_dn`t'*hw_close 
}
*
gen hur_close_d0=hur_landfall_d0*hw_close 
forvalues t = 1/14 {
	gen hur_close_d`t' = hur_landfall_d`t'*hw_close 		
}
*
*Highways Mid
forvalues t = 1/14 {
	gen hur_mid_dn`t'=hur_landfall_dn`t'*hw_mid 
}
*
gen hur_mid_d0=hur_landfall_d0*hw_mid 
forvalues t = 1/14 {
	gen hur_mid_d`t' = hur_landfall_d`t'*hw_mid 		
}
*
*Competition Far
forvalues t = 1/14 {
	gen hur_far_dn`t'=hur_landfall_dn`t'*hw_far 
}
*
gen hur_far_d0=hur_landfall_d0*hw_far 
forvalues t = 1/14 {
	gen hur_far_d`t' = hur_landfall_d`t'*hw_far 		
}
*
*****
*Hurricane Margins
reghdfe retail hur_close_dn1-hur_far_d14 ///
		CTST CHRT CTSN CHRN temp temp2 wholesale if window_landfall>=1, ///
	    absorb(station_id year month dow) cluster(county_FIPS)	
*			
replace d=-14 in 1
replace xb_hur1=0 in 1
replace hi_hur1=0 in 1
replace lo_hur1=0 in 1
*
forvalues i = 2/14 {
	local j=-1*(`i'-15)
	replace d=-1*`j' in `i'	
	lincom hur_close_dn`j'-hur_close_dn14
	replace xb_hur1    = r(estimate) in `i'
	replace hi_hur1 = r(estimate) + 1.96*r(se)  in `i'
	replace lo_hur1 = r(estimate) - 1.96*r(se) in `i'

}
*
forvalues i = 0/14 {
	local j=`i'+15
	replace d=`i' in `j'
	lincom hur_close_d`i'-hur_close_dn14
	replace xb_hur1    = r(estimate) in `j'
	replace hi_hur1 = r(estimate) + 1.96*r(se)  in `j'
	replace lo_hur1 = r(estimate) - 1.96*r(se) in `j'
}
*	
forvalues i = 2/14 {
	local j=-1*(`i'-15)
	lincom hur_mid_dn`j'-hur_mid_dn14
	replace xb_hur2    = r(estimate) in `i'
	replace hi_hur2 = r(estimate) + 1.96*r(se)  in `i'
	replace lo_hur2 = r(estimate) - 1.96*r(se) in `i'

}
*
forvalues i = 0/14 {
	local j=`i'+15
	lincom hur_mid_d`i'-hur_mid_dn14
	replace xb_hur2    = r(estimate) in `j'
	replace hi_hur2 = r(estimate) + 1.96*r(se)  in `j'
	replace lo_hur2 = r(estimate) - 1.96*r(se) in `j'
}
*		
forvalues i = 2/14 {
	local j=-1*(`i'-15)
	lincom hur_far_dn`j'-hur_far_dn14
	replace xb_hur3    = r(estimate) in `i'
	replace hi_hur3 = r(estimate) + 1.96*r(se)  in `i'
	replace lo_hur3 = r(estimate) - 1.96*r(se) in `i'

}
*
forvalues i = 0/14 {
	local j=`i'+15
	lincom hur_far_d`i'-hur_far_dn14
	replace xb_hur3    = r(estimate) in `j'
	replace hi_hur3 = r(estimate) + 1.96*r(se)  in `j'
	replace lo_hur3 = r(estimate) - 1.96*r(se) in `j'
}
*
*Graph
tw(connected xb_hur2 d, m(D) mfcolor(white) mlcolor(black) msize(medium) lcolor(dkorange) lwidth(medthick) mlwidth(medium)) ///
  (connected xb_hur3 d, m(T) mfcolor(white) mlcolor(black) msize(medium) lcolor(edkblue) lwidth(medthick) mlwidth(medium)) ///
  (connected xb_hur1 d, m(O) mfcolor(white) mlcolor(black) msize(medium) lcolor(cranberry) lwidth(medthick) mlwidth(medium)) ///
  	(line hi_hur1 d, lpattern(dash) lcolor(erose)) ///
	(line lo_hur1 d, lpattern(dash) lcolor(erose)), ///, ///
	graphr(color(white)) ///
	yscale(noline) ///
	xtit("Days Before/After Hurricane Landfall") ///
	ytit("Margin ($/gal)") ///
	ylabel(-0.1(0.05)0.1 ,nogrid angle(0)) ///
	xlabel(-14(2)14) ///
	yline(0, lcolor(black))   ///
	xline(0,lcolor(black) lp(dash)) ///
	legend(order(3 "<0.01 km" 1 "0.01-2.5 km" 2 ">2.5 km") size(vsmall) ///
	    region(lcolor(white)) cols(1) ring(0) position(11))  
graph export $figs/event_margins_highway_$outputdate.png, replace width(4000)
drop d-hur_far_d14
*
*
***********************************
*FIGURE 3(D) - CAT 5/CAT 4/CAT 1-3
gen d=. in 1
gen xb_hur1 = . in 1
	gen hi_hur1 = . in 1
	gen lo_hur1 = . in 1	
gen xb_hur2 = . in 1
	gen hi_hur2 = . in 1
	gen lo_hur2 = . in 1


*Creating day 0 event-study indicators
gsort station_id date
gen hur_cat45_d0=0 
	replace hur_cat45_d0=1 if IVAN_landfall==1 & date==`=td(16sep2004)'
	replace hur_cat45_d0=1 if KATRINA_FL_landfall==1 & date==`=td(25aug2005)'
	replace hur_cat45_d0=1 if KATRINA_LA_landfall==1 & date==`=td(29aug2005)'
	replace hur_cat45_d0=1 if RITA_landfall==1 & date==`=td(24sep2005)'
	replace hur_cat45_d0=1 if WILMA_landfall==1 & date==`=td(24oct2005)'
	replace hur_cat45_d0=1 if BONCHAR_landfall==1 & date==`=td(12aug2004)'
	replace hur_cat45_d0=1 if FRANCES_landfall==1 & date==`=td(06sep2004)'
	replace hur_cat45_d0=1 if DENNIS_landfall==1 & date==`=td(10jul2005)'
	replace hur_cat45_d0=1 if GUSTAV_landfall==1 & date==`=td(01sep2008)'
	replace hur_cat45_d0=1 if IKE_landfall==1 & date==`=td(13sep2008)'
gen hur_cat13_d0=0 
	replace hur_cat13_d0=1 if JEANNE_landfall==1 & date==`=td(26sep2004)'
	replace hur_cat13_d0=1 if HUMBERTO_landfall==1 & date==`=td(13sep2007)'
	replace hur_cat13_d0=1 if ARLENE_landfall==1 & date==`=td(11jun2005)'
	replace hur_cat13_d0=1 if ALBERTO_landfall==1 & date==`=td(13jun2006)'

	
****
*Creating 14-day event windows   
drop event_day
gen event_day=. //Event day variable
	replace event_day=0 if hur_cat45_d0==1|hur_cat13_d0==1
	
*Indicators: 14 Days Prior to Hurricane for Different Samples
forvalues t = 1/14 {
	local n=-1*(`t')
	*Year check
	gen y=f`t'.year
	*CAT 5 
	gen hur_cat45_dn`t' = 0
		replace hur_cat45_dn`t' = 1 if f`t'.hur_cat45_d0==1 & y==year
	*CAT 1/3 
	gen hur_cat13_dn`t'=0
		replace hur_cat13_dn`t'= 1 if f`t'.hur_cat13_d0==1  & y==year	
	*Event day  
	replace event_day=`n' if hur_cat45_dn`t'==1|hur_cat13_dn`t'==1
		
	drop y
}
*
*Indicators: 14 Days After Hurricane
forvalues t = 1/14 {
	*Year check
	gen y=l`t'.year
	*CAT 5 
	gen hur_cat45_d`t' = 0		
		replace hur_cat45_d`t' = 1 if l`t'.hur_cat45_d0==1 & y==year
	*CAT 1/3 
	gen hur_cat13_d`t'=0
		replace hur_cat13_d`t' = 1 if l`t'.hur_cat13_d0==1 & y==year
	*Event day  
	replace event_day=`t' if hur_cat45_d`t'==1|hur_cat13_d`t'==1
	drop y		
}
*
order hur_cat45_dn14 hur_cat45_dn13 hur_cat45_dn12 hur_cat45_dn11 ///
      hur_cat45_dn10 hur_cat45_dn9 hur_cat45_dn8 hur_cat45_dn7 ///
	  hur_cat45_dn6 hur_cat45_dn5 hur_cat45_dn4 hur_cat45_dn3 ///
	  hur_cat45_dn2 hur_cat45_dn1 hur_cat45_d0 hur_cat45_d1 ///
	  hur_cat45_d2 hur_cat45_d3 hur_cat45_d4 hur_cat45_d5 ///
	  hur_cat45_d6 hur_cat45_d7 hur_cat45_d8 hur_cat45_d9 ///
	  hur_cat45_d10 hur_cat45_d11 hur_cat45_d12 hur_cat45_d13 ///
	  hur_cat45_d14 ///
	  hur_cat13_dn14 hur_cat13_dn13 hur_cat13_dn12 hur_cat13_dn11 hur_cat13_dn10 ///
	  hur_cat13_dn9 hur_cat13_dn8 hur_cat13_dn7 hur_cat13_dn6 hur_cat13_dn5 ///
	  hur_cat13_dn4 hur_cat13_dn3 hur_cat13_dn2 hur_cat13_dn1 hur_cat13_d0 ///
	  hur_cat13_d1 hur_cat13_d2 hur_cat13_d3 hur_cat13_d4 hur_cat13_d5 ///
	  hur_cat13_d6 hur_cat13_d7 hur_cat13_d8 hur_cat13_d9 hur_cat13_d10 ///
	  hur_cat13_d11 hur_cat13_d12 hur_cat13_d13 hur_cat13_d14, last
*
*Event window indicators 
egen window_cat45=rowtotal(hur_cat45_dn14-hur_cat45_d14)  //Event study - CAT 5
egen window_cat13=rowtotal(hur_cat13_dn14-hur_cat13_d14)  //Event study - CAT 1/3
*
*Hurricane CAT5 - Margins		
reghdfe retail hur_cat45_dn14-hur_cat45_d14 ///
		CTST CHRT CTSN CHRN temp temp2 wholesale if window_cat45>=1, ///
	    absorb(station_id year month dow) cluster(county_FIPS)	
*			
replace d=-14 in 1
replace xb_hur1=0 in 1
replace hi_hur1=0 in 1
replace lo_hur1=0 in 1
*
forvalues i = 2/14 {
	local j=-1*(`i'-15)
	replace d=-1*`j' in `i'	
	lincom hur_cat45_dn`j'-hur_cat45_dn14
	replace xb_hur1    = r(estimate) in `i'
	replace hi_hur1 = r(estimate) + 1.96*r(se)  in `i'
	replace lo_hur1 = r(estimate) - 1.96*r(se) in `i'

}
*
forvalues i = 0/14 {
	local j=`i'+15
	replace d=`i' in `j'
	lincom hur_cat45_d`i'-hur_cat45_dn14
	replace xb_hur1    = r(estimate) in `j'
	replace hi_hur1 = r(estimate) + 1.96*r(se)  in `j'
	replace lo_hur1 = r(estimate) - 1.96*r(se) in `j'
}
*	
*Hurricane CAT1/3 - Margins		
reghdfe retail hur_cat13_dn13-hur_cat13_d14 ///
		CTST CHRT CTSN CHRN temp temp2 wholesale if window_cat13>=1, ///
	    absorb(station_id year month dow) cluster(county_FIPS)	
		
replace xb_hur2=0 in 1
replace hi_hur2=0 in 1
replace lo_hur2=0 in 1
		
forvalues i = 2/14 {
	local j=-1*(`i'-15)
	lincom hur_cat13_dn`j'
	replace xb_hur2    = r(estimate) in `i'
	replace hi_hur2 = r(estimate) + 1.96*r(se)  in `i'
	replace lo_hur2 = r(estimate) - 1.96*r(se) in `i'

}
*
forvalues i = 0/14 {
	local j=`i'+15
	lincom hur_cat13_d`i'
	replace xb_hur2    = r(estimate) in `j'
	replace hi_hur2 = r(estimate) + 1.96*r(se)  in `j'
	replace lo_hur2 = r(estimate) - 1.96*r(se) in `j'
}
*
*Graph
tw(connected xb_hur2 d, m(T) mfcolor(white) mlcolor(black) msize(medium) lcolor(edkblue) lwidth(medthick) mlwidth(medium)) ///
  (connected xb_hur1 d, m(O) mfcolor(white) mlcolor(black) msize(medium) lcolor(cranberry) lwidth(medthick) mlwidth(medium)) ///
  	(line hi_hur1 d, lpattern(dash) lcolor(erose)) ///
	(line lo_hur1 d, lpattern(dash) lcolor(erose)), ///
	graphr(color(white)) ///
	yscale(noline) ///
	xtit("Days Before/After Hurricane Landfall") ///
	ytit("Margin ($/gal)") ///
	ylabel(-0.1(0.05)0.15 ,nogrid angle(0)) ///
	xlabel(-14(2)14) ///
	yline(0, lcolor(black))   ///
	xline(0,lcolor(black) lp(dash)) 	///
	legend(order(2 "CAT 4/5" 1 "CAT1/3") size(vsmall) ///
	    region(lcolor(white)) cols(1) ring(0) position(11))  
graph export $figs/event_prices_cat_$outputdate.png, replace width(4000)
drop d-window_cat13
			 
			 
	
********************************************************************************
*FIGURE 4 - WHOLESALE COST PASS-THROUGH TO RETAIL PRICES
********************************************************************************
*
***********************************
*FIGURE 4(A) - HURRICAN SHOCKS, LANDFALL STATIONS
*Landfall - 30 Day Window Sample
gen landfall_hur_sample=0 
	replace landfall_hur_sample=1 if BONCHAR_landfall==1 & date==`=td(12aug2004)'
	replace landfall_hur_sample=1 if FRANCES_landfall==1 & date==`=td(06sep2004)'
	replace landfall_hur_sample=1 if IVAN_landfall==1 & date==`=td(16sep2004)'
	replace landfall_hur_sample=1 if JEANNE_landfall==1 & date==`=td(26sep2004)'
	replace landfall_hur_sample=1 if ARLENE_landfall==1 & date==`=td(11jun2005)'
	replace landfall_hur_sample=1 if DENNIS_landfall==1 & date==`=td(10jul2005)'
	replace landfall_hur_sample=1 if KATRINA_FL_landfall==1 & date==`=td(25aug2005)'
	replace landfall_hur_sample=1 if KATRINA_LA_landfall==1 & date==`=td(29aug2005)'
	replace landfall_hur_sample=1 if RITA_landfall==1 & date==`=td(24sep2005)'
	replace landfall_hur_sample=1 if WILMA_landfall==1 & date==`=td(24oct2005)'
	replace landfall_hur_sample=1 if ALBERTO_landfall==1 & date==`=td(13jun2006)'
	replace landfall_hur_sample=1 if HUMBERTO_landfall==1 & date==`=td(13sep2007)'
	replace landfall_hur_sample=1 if GUSTAV_landfall==1 & date==`=td(01sep2008)'
	replace landfall_hur_sample=1 if IKE_landfall==1 & date==`=td(13sep2008)'


*Filling in pre-hurricane indicators
gen hur_temp=0 //First day of hurricane
	replace hur_temp=1 if landfall_hur_sample==1 & l.landfall_hur_sample==0
forvalues t = 1/30 {
	gen y=f`t'.year
	replace landfall_hur_sample=1 if f`t'.hur_temp==1 & y==year
	drop y
}
*
drop hur_temp

*Filling in post-hurricane indicators
gen hur_temp=0 //Last day of hurricane
	replace hur_temp=1 if landfall_hur_sample==1 & f.landfall_hur_sample==0	
forvalues t = 1/30 {
	gen y=l`t'.year
	replace landfall_hur_sample=1 if l`t'.hur_temp==1 & y==year
	drop y
}
*
drop hur_temp


eststo clear 		   

*Variables
gen event_d=.
	label var event_d "Event Day"
gen pt1=.
	gen pt1_95l=.
	gen pt1_95u=.
	label var pt1 "All"
gen pt3=.
	gen pt3_95l=.
	gen pt3_95u=.
	label var pt3 "Landfall (Hurricane)"

reghdfe retail l(0/29).d.wholesale l30.wholesale temp temp2 CTST CHRT CTSN CHRN if landfall_hur_sample==1, ///
			   absorb(station_id year month dow) cluster(county_FIPS)
est store B

*Day 0
replace event_d=0 in 1
replace pt1=_b[D1.wholesale]   in 1
replace pt1_95l=_b[D1.wholesale]-1.96*_se[D1.wholesale] in 1
replace pt1_95u=_b[D1.wholesale]+1.96*_se[D1.wholesale] in 1
	
*Day 1
replace event_d=1 in 2
replace pt1=_b[LD.wholesale] in 2
replace pt1_95l=_b[LD.wholesale]-1.96*_se[L`i'D.wholesale] in 2
replace pt1_95u=_b[LD.wholesale]+1.96*_se[L`i'D.wholesale] in 2
*
forvalues i = 2/29 {
	local j=`i'+1
	replace event_d=`i' in `j'
	replace pt1=_b[L`i'D.wholesale] in `j'
	replace pt1_95l=_b[L`i'D.wholesale]-1.96*_se[LD.wholesale] in `j'
	replace pt1_95u=_b[L`i'D.wholesale]+1.96*_se[LD.wholesale] in `j'
}
*			   
*Day 30
replace event_d=30 in 31
replace pt1=_b[L30.wholesale] in 31
replace pt1_95l=_b[L30.wholesale]-1.96*_se[L30.wholesale] in 31
replace pt1_95u=_b[L30.wholesale]+1.96*_se[L30.wholesale] in 31	

*Staggering
gen event_d1=event_d+0.1
gen event_d2=event_d-0.1

*Pass-Through
twoway rcap pt1_95u pt1_95l event_d, lstyle(ci) lc(cranberry) || ///
	   scatter pt1 event_d, m(triangle) mc(cranberry) msize(medsmall)  ///                 
	   graphregion(color(white)) bgcolor(white) ///
	   legend(order(2 "Hurricane Window, Landfall Stations" ) ///
	   rows(2) region(lcolor(white))) ///
	   xtitle("Days After $1/gallon Wholesale Cost Shock") ///  
	   ytitle(Pass Through ($/gal)) xlabel(0(3)30, nogrid)  ///
	   ylabel(0(0.5)1, nogrid)  ///
	   yline(0 0.5  1, lstyle(grid) lcolor(black*0.05))
graph export $figs/pt_landfall_$outputdate.png, replace width(4000)
//drop _est_A-event_d2
			 
			 
***********************************
*FIGURE 4(B) - Positive Shocks (All Stations/Periods) vs. Hurricane Shocks
gen dwholesale_p=max(d.wholesale,0)
gen dwholesale_n=min(d.wholesale,0)
gen cons=1

*Variables
gen pt1p=.
	gen pt1p_95l=.
	gen pt1p_95u=.
	label var pt1p "Landfall (Postive)"	
*
*All Stations, All Periods
reghdfe d.retail l(0/30).dwholesale_p l(0/30).dwholesale_n temp temp2, ///
		absorb(cons) cluster(county_FIPS)
		
*Positive Shocks
	replace pt1p=_b[dwholesale_p] in 1
		replace pt1p_95l=_b[dwholesale_p]- 1.96*_se[dwholesale_p] in 1
		replace pt1p_95u=_b[dwholesale_p]+ 1.96*_se[dwholesale_p] in 1
	lincom dwholesale_p+L1.dwholesale_p
		replace pt1p=r(estimate) in 2
		replace pt1p_95u=r(estimate)+1.96*r(se) in 2
		replace pt1p_95l=r(estimate)-1.96*r(se) in 2
	lincom dwholesale_p+L1.dwholesale_p+L2.dwholesale_p
		replace pt1p=r(estimate) in 3
		replace pt1p_95u=r(estimate)+1.96*r(se) in 3
		replace pt1p_95l=r(estimate)-1.96*r(se) in 3
	lincom dwholesale_p+L1.dwholesale_p+L2.dwholesale_p+L3.dwholesale_p
		replace pt1p=r(estimate) in 4
		replace pt1p_95u=r(estimate)+1.96*r(se) in 4
		replace pt1p_95l=r(estimate)-1.96*r(se) in 4
	lincom dwholesale_p+L1.dwholesale_p+L2.dwholesale_p+L3.dwholesale_p+L4.dwholesale_p
		replace pt1p=r(estimate) in 5
		replace pt1p_95u=r(estimate)+1.96*r(se) in 5
		replace pt1p_95l=r(estimate)-1.96*r(se) in 5
	lincom dwholesale_p+L1.dwholesale_p+L2.dwholesale_p+L3.dwholesale_p+L4.dwholesale_p+ ///
		   L5.dwholesale_p
		replace pt1p=r(estimate) in 6
		replace pt1p_95u=r(estimate)+1.96*r(se) in 6
		replace pt1p_95l=r(estimate)-1.96*r(se) in 6			
	lincom dwholesale_p+L1.dwholesale_p+L2.dwholesale_p+L3.dwholesale_p+L4.dwholesale_p+ ///
		   L5.dwholesale_p+L6.dwholesale_p
		replace pt1p=r(estimate) in 7
		replace pt1p_95u=r(estimate)+1.96*r(se) in 7
		replace pt1p_95l=r(estimate)-1.96*r(se) in 7	
	lincom dwholesale_p+L1.dwholesale_p+L2.dwholesale_p+L3.dwholesale_p+L4.dwholesale_p+ ///
		   L5.dwholesale_p+L6.dwholesale_p+L7.dwholesale_p
		replace pt1p=r(estimate) in 8
		replace pt1p_95u=r(estimate)+1.96*r(se) in 8
		replace pt1p_95l=r(estimate)-1.96*r(se) in 8			
	lincom dwholesale_p+L1.dwholesale_p+L2.dwholesale_p+L3.dwholesale_p+L4.dwholesale_p+ ///
		   L5.dwholesale_p+L6.dwholesale_p+L7.dwholesale_p+L8.dwholesale_p
		replace pt1p=r(estimate) in 9
		replace pt1p_95u=r(estimate)+1.96*r(se) in 9
		replace pt1p_95l=r(estimate)-1.96*r(se) in 9			
	lincom dwholesale_p+L1.dwholesale_p+L2.dwholesale_p+L3.dwholesale_p+L4.dwholesale_p+ ///
		   L5.dwholesale_p+L6.dwholesale_p+L7.dwholesale_p+L8.dwholesale_p+L9.dwholesale_p
		replace pt1p=r(estimate) in 10
		replace pt1p_95u=r(estimate)+1.96*r(se) in 10
		replace pt1p_95l=r(estimate)-1.96*r(se) in 10			   
	lincom dwholesale_p+L1.dwholesale_p+L2.dwholesale_p+L3.dwholesale_p+L4.dwholesale_p+ ///
		   L5.dwholesale_p+L6.dwholesale_p+L7.dwholesale_p+L8.dwholesale_p+L9.dwholesale_p+ ///
		   L10.dwholesale_p
		replace pt1p=r(estimate) in 11
		replace pt1p_95u=r(estimate)+1.96*r(se) in 11
		replace pt1p_95l=r(estimate)-1.96*r(se) in 11			   
	lincom dwholesale_p+L1.dwholesale_p+L2.dwholesale_p+L3.dwholesale_p+L4.dwholesale_p+ ///
		   L5.dwholesale_p+L6.dwholesale_p+L7.dwholesale_p+L8.dwholesale_p+L9.dwholesale_p+ ///
		   L10.dwholesale_p+L11.dwholesale_p
		replace pt1p=r(estimate) in 12
		replace pt1p_95u=r(estimate)+1.96*r(se) in 12
		replace pt1p_95l=r(estimate)-1.96*r(se) in 12	
	lincom dwholesale_p+L1.dwholesale_p+L2.dwholesale_p+L3.dwholesale_p+L4.dwholesale_p+ ///
		   L5.dwholesale_p+L6.dwholesale_p+L7.dwholesale_p+L8.dwholesale_p+L9.dwholesale_p+ ///
		   L10.dwholesale_p+L11.dwholesale_p+L12.dwholesale_p
		replace pt1p=r(estimate) in 13
		replace pt1p_95u=r(estimate)+1.96*r(se) in 13
		replace pt1p_95l=r(estimate)-1.96*r(se) in 13	
	lincom dwholesale_p+L1.dwholesale_p+L2.dwholesale_p+L3.dwholesale_p+L4.dwholesale_p+ ///
		   L5.dwholesale_p+L6.dwholesale_p+L7.dwholesale_p+L8.dwholesale_p+L9.dwholesale_p+ ///
		   L10.dwholesale_p+L11.dwholesale_p+L12.dwholesale_p+L13.dwholesale_p
		replace pt1p=r(estimate) in 14
		replace pt1p_95u=r(estimate)+1.96*r(se) in 14
		replace pt1p_95l=r(estimate)-1.96*r(se) in 14	
	lincom dwholesale_p+L1.dwholesale_p+L2.dwholesale_p+L3.dwholesale_p+L4.dwholesale_p+ ///
		   L5.dwholesale_p+L6.dwholesale_p+L7.dwholesale_p+L8.dwholesale_p+L9.dwholesale_p+ ///
		   L10.dwholesale_p+L11.dwholesale_p+L12.dwholesale_p+L13.dwholesale_p+L14.dwholesale_p
		replace pt1p=r(estimate) in 15
		replace pt1p_95u=r(estimate)+1.96*r(se) in 15
		replace pt1p_95l=r(estimate)-1.96*r(se) in 15			
	lincom dwholesale_p+L1.dwholesale_p+L2.dwholesale_p+L3.dwholesale_p+L4.dwholesale_p+ ///
		   L5.dwholesale_p+L6.dwholesale_p+L7.dwholesale_p+L8.dwholesale_p+L9.dwholesale_p+ ///
		   L10.dwholesale_p+L11.dwholesale_p+L12.dwholesale_p+L13.dwholesale_p+L14.dwholesale_p+ ///
		   L15.dwholesale_p
		replace pt1p=r(estimate) in 16
		replace pt1p_95u=r(estimate)+1.96*r(se) in 16
		replace pt1p_95l=r(estimate)-1.96*r(se) in 16					
	lincom dwholesale_p+L1.dwholesale_p+L2.dwholesale_p+L3.dwholesale_p+L4.dwholesale_p+ ///
		   L5.dwholesale_p+L6.dwholesale_p+L7.dwholesale_p+L8.dwholesale_p+L9.dwholesale_p+ ///
		   L10.dwholesale_p+L11.dwholesale_p+L12.dwholesale_p+L13.dwholesale_p+L14.dwholesale_p+ ///
		   L15.dwholesale_p+L16.dwholesale_p
		replace pt1p=r(estimate) in 17
		replace pt1p_95u=r(estimate)+1.96*r(se) in 17
		replace pt1p_95l=r(estimate)-1.96*r(se) in 17			
	lincom dwholesale_p+L1.dwholesale_p+L2.dwholesale_p+L3.dwholesale_p+L4.dwholesale_p+ ///
		   L5.dwholesale_p+L6.dwholesale_p+L7.dwholesale_p+L8.dwholesale_p+L9.dwholesale_p+ ///
		   L10.dwholesale_p+L11.dwholesale_p+L12.dwholesale_p+L13.dwholesale_p+L14.dwholesale_p+ ///
		   L15.dwholesale_p+L16.dwholesale_p+L17.dwholesale_p
		replace pt1p=r(estimate) in 18
		replace pt1p_95u=r(estimate)+1.96*r(se) in 18
		replace pt1p_95l=r(estimate)-1.96*r(se) in 18		
	lincom dwholesale_p+L1.dwholesale_p+L2.dwholesale_p+L3.dwholesale_p+L4.dwholesale_p+ ///
		   L5.dwholesale_p+L6.dwholesale_p+L7.dwholesale_p+L8.dwholesale_p+L9.dwholesale_p+ ///
		   L10.dwholesale_p+L11.dwholesale_p+L12.dwholesale_p+L13.dwholesale_p+L14.dwholesale_p+ ///
		   L15.dwholesale_p+L16.dwholesale_p+L17.dwholesale_p+L18.dwholesale_p
		replace pt1p=r(estimate) in 19
		replace pt1p_95u=r(estimate)+1.96*r(se) in 19
		replace pt1p_95l=r(estimate)-1.96*r(se) in 19		
	lincom dwholesale_p+L1.dwholesale_p+L2.dwholesale_p+L3.dwholesale_p+L4.dwholesale_p+ ///
		   L5.dwholesale_p+L6.dwholesale_p+L7.dwholesale_p+L8.dwholesale_p+L9.dwholesale_p+ ///
		   L10.dwholesale_p+L11.dwholesale_p+L12.dwholesale_p+L13.dwholesale_p+L14.dwholesale_p+ ///
		   L15.dwholesale_p+L16.dwholesale_p+L17.dwholesale_p+L18.dwholesale_p+L19.dwholesale_p
		replace pt1p=r(estimate) in 20
		replace pt1p_95u=r(estimate)+1.96*r(se) in 20
		replace pt1p_95l=r(estimate)-1.96*r(se) in 20
	lincom dwholesale_p+L1.dwholesale_p+L2.dwholesale_p+L3.dwholesale_p+L4.dwholesale_p+ ///
		   L5.dwholesale_p+L6.dwholesale_p+L7.dwholesale_p+L8.dwholesale_p+L9.dwholesale_p+ ///
		   L10.dwholesale_p+L11.dwholesale_p+L12.dwholesale_p+L13.dwholesale_p+L14.dwholesale_p+ ///
		   L15.dwholesale_p+L16.dwholesale_p+L17.dwholesale_p+L18.dwholesale_p+L19.dwholesale_p+ ///
		   L20.dwholesale_p
		replace pt1p=r(estimate) in 21
		replace pt1p_95u=r(estimate)+1.96*r(se) in 21
		replace pt1p_95l=r(estimate)-1.96*r(se) in 21		
	lincom dwholesale_p+L1.dwholesale_p+L2.dwholesale_p+L3.dwholesale_p+L4.dwholesale_p+ ///
		   L5.dwholesale_p+L6.dwholesale_p+L7.dwholesale_p+L8.dwholesale_p+L9.dwholesale_p+ ///
		   L10.dwholesale_p+L11.dwholesale_p+L12.dwholesale_p+L13.dwholesale_p+L14.dwholesale_p+ ///
		   L15.dwholesale_p+L16.dwholesale_p+L17.dwholesale_p+L18.dwholesale_p+L19.dwholesale_p+ ///
		   L20.dwholesale_p+L21.dwholesale_p
		replace pt1p=r(estimate) in 22
		replace pt1p_95u=r(estimate)+1.96*r(se) in 22
		replace pt1p_95l=r(estimate)-1.96*r(se) in 22			
	lincom dwholesale_p+L1.dwholesale_p+L2.dwholesale_p+L3.dwholesale_p+L4.dwholesale_p+ ///
		   L5.dwholesale_p+L6.dwholesale_p+L7.dwholesale_p+L8.dwholesale_p+L9.dwholesale_p+ ///
		   L10.dwholesale_p+L11.dwholesale_p+L12.dwholesale_p+L13.dwholesale_p+L14.dwholesale_p+ ///
		   L15.dwholesale_p+L16.dwholesale_p+L17.dwholesale_p+L18.dwholesale_p+L19.dwholesale_p+ ///
		   L20.dwholesale_p+L21.dwholesale_p+L22.dwholesale_p
		replace pt1p=r(estimate) in 23
		replace pt1p_95u=r(estimate)+1.96*r(se) in 23
		replace pt1p_95l=r(estimate)-1.96*r(se) in 23	
	lincom dwholesale_p+L1.dwholesale_p+L2.dwholesale_p+L3.dwholesale_p+L4.dwholesale_p+ ///
		   L5.dwholesale_p+L6.dwholesale_p+L7.dwholesale_p+L8.dwholesale_p+L9.dwholesale_p+ ///
		   L10.dwholesale_p+L11.dwholesale_p+L12.dwholesale_p+L13.dwholesale_p+L14.dwholesale_p+ ///
		   L15.dwholesale_p+L16.dwholesale_p+L17.dwholesale_p+L18.dwholesale_p+L19.dwholesale_p+ ///
		   L20.dwholesale_p+L21.dwholesale_p+L22.dwholesale_p+L23.dwholesale_p
		replace pt1p=r(estimate) in 24
		replace pt1p_95u=r(estimate)+1.96*r(se) in 24
		replace pt1p_95l=r(estimate)-1.96*r(se) in 24	
	lincom dwholesale_p+L1.dwholesale_p+L2.dwholesale_p+L3.dwholesale_p+L4.dwholesale_p+ ///
		   L5.dwholesale_p+L6.dwholesale_p+L7.dwholesale_p+L8.dwholesale_p+L9.dwholesale_p+ ///
		   L10.dwholesale_p+L11.dwholesale_p+L12.dwholesale_p+L13.dwholesale_p+L14.dwholesale_p+ ///
		   L15.dwholesale_p+L16.dwholesale_p+L17.dwholesale_p+L18.dwholesale_p+L19.dwholesale_p+ ///
		   L20.dwholesale_p+L21.dwholesale_p+L22.dwholesale_p+L23.dwholesale_p+L24.dwholesale_p
		replace pt1p=r(estimate) in 25
		replace pt1p_95u=r(estimate)+1.96*r(se) in 25
		replace pt1p_95l=r(estimate)-1.96*r(se) in 25
	lincom dwholesale_p+L1.dwholesale_p+L2.dwholesale_p+L3.dwholesale_p+L4.dwholesale_p+ ///
		   L5.dwholesale_p+L6.dwholesale_p+L7.dwholesale_p+L8.dwholesale_p+L9.dwholesale_p+ ///
		   L10.dwholesale_p+L11.dwholesale_p+L12.dwholesale_p+L13.dwholesale_p+L14.dwholesale_p+ ///
		   L15.dwholesale_p+L16.dwholesale_p+L17.dwholesale_p+L18.dwholesale_p+L19.dwholesale_p+ ///
		   L20.dwholesale_p+L21.dwholesale_p+L22.dwholesale_p+L23.dwholesale_p+L24.dwholesale_p+ ///
		   L25.dwholesale_p
		replace pt1p=r(estimate) in 26
		replace pt1p_95u=r(estimate)+1.96*r(se) in 26
		replace pt1p_95l=r(estimate)-1.96*r(se) in 26		
	lincom dwholesale_p+L1.dwholesale_p+L2.dwholesale_p+L3.dwholesale_p+L4.dwholesale_p+ ///
		   L5.dwholesale_p+L6.dwholesale_p+L7.dwholesale_p+L8.dwholesale_p+L9.dwholesale_p+ ///
		   L10.dwholesale_p+L11.dwholesale_p+L12.dwholesale_p+L13.dwholesale_p+L14.dwholesale_p+ ///
		   L15.dwholesale_p+L16.dwholesale_p+L17.dwholesale_p+L18.dwholesale_p+L19.dwholesale_p+ ///
		   L20.dwholesale_p+L21.dwholesale_p+L22.dwholesale_p+L23.dwholesale_p+L24.dwholesale_p+ ///
		   L25.dwholesale_p+L26.dwholesale_p
		replace pt1p=r(estimate) in 27
		replace pt1p_95u=r(estimate)+1.96*r(se) in 27
		replace pt1p_95l=r(estimate)-1.96*r(se) in 27	
	lincom dwholesale_p+L1.dwholesale_p+L2.dwholesale_p+L3.dwholesale_p+L4.dwholesale_p+ ///
		   L5.dwholesale_p+L6.dwholesale_p+L7.dwholesale_p+L8.dwholesale_p+L9.dwholesale_p+ ///
		   L10.dwholesale_p+L11.dwholesale_p+L12.dwholesale_p+L13.dwholesale_p+L14.dwholesale_p+ ///
		   L15.dwholesale_p+L16.dwholesale_p+L17.dwholesale_p+L18.dwholesale_p+L19.dwholesale_p+ ///
		   L20.dwholesale_p+L21.dwholesale_p+L22.dwholesale_p+L23.dwholesale_p+L24.dwholesale_p+ ///
		   L25.dwholesale_p+L26.dwholesale_p+L27.dwholesale_p
		replace pt1p=r(estimate) in 28
		replace pt1p_95u=r(estimate)+1.96*r(se) in 28
		replace pt1p_95l=r(estimate)-1.96*r(se) in 28			
	lincom dwholesale_p+L1.dwholesale_p+L2.dwholesale_p+L3.dwholesale_p+L4.dwholesale_p+ ///
		   L5.dwholesale_p+L6.dwholesale_p+L7.dwholesale_p+L8.dwholesale_p+L9.dwholesale_p+ ///
		   L10.dwholesale_p+L11.dwholesale_p+L12.dwholesale_p+L13.dwholesale_p+L14.dwholesale_p+ ///
		   L15.dwholesale_p+L16.dwholesale_p+L17.dwholesale_p+L18.dwholesale_p+L19.dwholesale_p+ ///
		   L20.dwholesale_p+L21.dwholesale_p+L22.dwholesale_p+L23.dwholesale_p+L24.dwholesale_p+ ///
		   L25.dwholesale_p+L26.dwholesale_p+L27.dwholesale_p+L28.dwholesale_p
		replace pt1p=r(estimate) in 29
		replace pt1p_95u=r(estimate)+1.96*r(se) in 29
		replace pt1p_95l=r(estimate)-1.96*r(se) in 29
	lincom dwholesale_p+L1.dwholesale_p+L2.dwholesale_p+L3.dwholesale_p+L4.dwholesale_p+ ///
		   L5.dwholesale_p+L6.dwholesale_p+L7.dwholesale_p+L8.dwholesale_p+L9.dwholesale_p+ ///
		   L10.dwholesale_p+L11.dwholesale_p+L12.dwholesale_p+L13.dwholesale_p+L14.dwholesale_p+ ///
		   L15.dwholesale_p+L16.dwholesale_p+L17.dwholesale_p+L18.dwholesale_p+L19.dwholesale_p+ ///
		   L20.dwholesale_p+L21.dwholesale_p+L22.dwholesale_p+L23.dwholesale_p+L24.dwholesale_p+ ///
		   L25.dwholesale_p+L26.dwholesale_p+L27.dwholesale_p+L28.dwholesale_p+L29.dwholesale_p
		replace pt1p=r(estimate) in 30
		replace pt1p_95u=r(estimate)+1.96*r(se) in 30
		replace pt1p_95l=r(estimate)-1.96*r(se) in 30
	lincom dwholesale_p+L1.dwholesale_p+L2.dwholesale_p+L3.dwholesale_p+L4.dwholesale_p+ ///
		   L5.dwholesale_p+L6.dwholesale_p+L7.dwholesale_p+L8.dwholesale_p+L9.dwholesale_p+ ///
		   L10.dwholesale_p+L11.dwholesale_p+L12.dwholesale_p+L13.dwholesale_p+L14.dwholesale_p+ ///
		   L15.dwholesale_p+L16.dwholesale_p+L17.dwholesale_p+L18.dwholesale_p+L19.dwholesale_p+ ///
		   L20.dwholesale_p+L21.dwholesale_p+L22.dwholesale_p+L23.dwholesale_p+L24.dwholesale_p+ ///
		   L25.dwholesale_p+L26.dwholesale_p+L27.dwholesale_p+L28.dwholesale_p+L29.dwholesale_p+ ///
		   L30.dwholesale_p
		replace pt1p=r(estimate) in 31
		replace pt1p_95u=r(estimate)+1.96*r(se) in 31
		replace pt1p_95l=r(estimate)-1.96*r(se) in 31
		
*Pass-Through
twoway scatter pt1p event_d1, m(diamond) mc(edkblue) msize(medsmall) || /// 
	   rcap pt1p_95u pt1p_95l event_d1, lstyle(ci) lc(edkblue) || ///
	   rcap pt1_95u pt1_95l event_d2, lstyle(ci) lc(cranberry) || ///
	   scatter pt1 event_d2, m(triangle) mc(cranberry) msize(medsmall)  ///                 
	   graphregion(color(white)) bgcolor(white) ///
	   legend(order(1 "All Periods, All Stations (Positive Shocks)" 4 "Hurricane Window, Landfall Stations" ) ///
	   rows(2) region(lcolor(white))) ///
	   xtitle("Days After $1/gallon Wholesale Cost Shock") ///  
	   ytitle(Pass Through ($/gal)) xlabel(0(3)30, nogrid)  ///
	   ylabel(0(0.5)1, nogrid)  ///
	   yline(0 0.5  1, lstyle(grid) lcolor(black*0.05))
graph export $figs/pt_all_pos_$outputdate.png, replace width(4000)	
frame change default